package com.swanclouds.model.managers;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.swanclouds.model.ModelEntity;

/**
 * @author 李文强
 * description
 */

public class GenerateCSR implements ModelEntity {

       //通用名称
       @JsonProperty("CommonName")
      private String commonName;
      //组织
      @JsonProperty("Organization")
      private String organization;
      //组织单位
      @JsonProperty("OrganizationUnit")
      private String organizationUnit;
      //城市或地点
      @JsonProperty("City")
      private String city;
      //州或省
      @JsonProperty("State")
      private String state;
      //国家
      @JsonProperty("Country")
      private String country;
      //电子邮件地址
      @JsonProperty("EmailId")
      private String emailId;
      //有效时间
      @JsonProperty("ValidDays")
      private Integer validDays;

    public String getCommonName() {
        return commonName;
    }

    public void setCommonName(String commonName) {
        this.commonName = commonName;
    }

    public String getOrganization() {
        return organization;
    }

    public void setOrganization(String organization) {
        this.organization = organization;
    }

    public String getOrganizationUnit() {
        return organizationUnit;
    }

    public void setOrganizationUnit(String organizationUnit) {
        this.organizationUnit = organizationUnit;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public String getEmailId() {
        return emailId;
    }

    public void setEmailId(String emailId) {
        this.emailId = emailId;
    }

    public Integer getValidDays() {
        return validDays;
    }

    public void setValidDays(Integer validDays) {
        this.validDays = validDays;
    }

    public static  GenerateCSR builder(){
       return new GenerateCSR();
    }

    public GenerateCSR commonName(String commonName){
        this.commonName = commonName;
        return this;
    }

    public GenerateCSR organization(String organization){
        this.organization = organization;
        return this;
    }

    public GenerateCSR organizationUnit(String organizationUnit){
        this.organizationUnit = organizationUnit;
        return this;
    }

    public GenerateCSR city(String city){
        this.city = city;
        return this;
    }

    public GenerateCSR state(String state){
        this.state = state;
        return this;
    }

    public GenerateCSR country(String country){
        this.country = country;
        return this;
    }

    public GenerateCSR emailId(String emailId){
        this.emailId = emailId;
        return this;
    }

    public GenerateCSR validDays(Integer validDays){
        this.validDays = validDays;
        return this;
    }

    @Override
    public String toString() {
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            return objectMapper.writeValueAsString(this);
        } catch (JsonProcessingException e) {
        }
        return "GenerateCSR{" +
                "commonName='" + commonName + '\'' +
                ", organization='" + organization + '\'' +
                ", organizationUnit='" + organizationUnit + '\'' +
                ", city='" + city + '\'' +
                ", state='" + state + '\'' +
                ", country='" + country + '\'' +
                ", emailId='" + emailId + '\'' +
                ", validDays=" + validDays +
                '}';
    }
}
